package com.zzsy.carosshopprojects.activitys.home.mainpage.common.payresult;

import android.content.Context;
import android.content.Intent;

import com.zzsy.carosshopprojects.R;
import com.zzsy.carosshopprojects.activitys.home.mainpage.barmanager.common.RechargeSuccessFragment;
import com.zzsy.carosshopprojects.base.BaseActivity;

import me.yokeyword.fragmentation.anim.FragmentAnimator;

public class PayResultAc extends BaseActivity {
    public static void start(Context mactivity, String orderNumber, String code, String payAmount, String kind) {
        Intent intent = new Intent(mactivity, PayResultAc.class);
        intent.putExtra("orderNumber", orderNumber);
        intent.putExtra("code", code);
        intent.putExtra("payAmount", payAmount);
        intent.putExtra("kind", kind);
        mactivity.startActivity(intent);
    }

    @Override
    protected int bindLayout() {
        return R.layout.ac_common;
    }

    @Override
    protected void initView() {
        if (getIntent().getStringExtra("orderNumber").contains("CZ"))//充值订单处理结果
        {
            if (getIntent().getStringExtra("code").equals("200"))
                loadRootFragment(R.id.fl_container, RechargeSuccessFragment.newInstance(getIntent().getStringExtra("orderNumber")));
            else
                loadRootFragment(R.id.fl_container, PayFailFragment.newInstance(getIntent().getStringExtra("code"), getIntent().getStringExtra("payAmount")));
        } else {
            String kind = getIntent().getStringExtra("kind");
            if (getIntent().getStringExtra("code").equals("200"))
                loadRootFragment(R.id.fl_container, PaySuccessFragment.newInstance(getIntent().getStringExtra("orderNumber"), Integer.valueOf(kind)));
            else
                loadRootFragment(R.id.fl_container, PayFailFragment.newInstance(getIntent().getStringExtra("code"), getIntent().getStringExtra("payAmount")));
        }

        //全局改变Fragment的动画
        setFragmentAnimator(new FragmentAnimator());
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void loadMethod() {

    }


}
